import Mock from "mockjs";
import users from "../data/user";
import orgs from "../data/orgs";
import { getRandomItems, backTimeout } from "../util/utils";
export default {
  getOutOrgs: async (ctx) => {
    const list = Mock.mock({
      "list|0-5": [
        {
          "id|+1": 0,
          outOrgName: "@ctitle(5)",
          "outOrgCode|100000-999999": 0,
        },
      ],
    });
    ctx.body = {
      code: "0",
      data: list.list,
    };
  },
  updateOutOrg: async (ctx) => {
    const { id, outOrgName, outOrgCode } = ctx.request.body;
    const data = Mock.mock({
      "id|0-100000000000": 0,
      outOrgName: outOrgName,
      outOrgCode: outOrgCode,
    });
    ctx.body = {
      code: "0",
      data: id ? data : null,
    };
    await backTimeout(1000);
    ctx.body = {
      code: "0",
      data: id ? null : data,
    };
  },
};
